package com.tbit.main.constant.enums;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.EnumValue;

/**
 * 调度申请处理方式
 *
 * 系统审核、人工审核
 * 包含三个字段 value  code  desc
 * system  1     系统审核
 *
 * @author <a href="mailto:chen.chaoxiong@tbit.com.cn">ChenChaoXiong</a>
 * @since 2024/7/24
 */
public enum DispatchApplyHandleType {

    UNKNOWN("unknown", 0, "未审核"),
    SYSTEM("system", 1, "系统审核"),
    MANUAL("manual", 2, "人工审核");

    private String value;
    @EnumValue
    private Integer code;
    private String desc;

    DispatchApplyHandleType(String value, Integer code, String desc) {
        this.value = value;
        this.code = code;
        this.desc = desc;
    }

    @JSONField(serialize = true)
    public String getValue() {
        return value;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static DispatchApplyHandleType getByCode(Integer code) {
        for (DispatchApplyHandleType type : DispatchApplyHandleType.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }
}
